package com.pig4cloud.pig.village.message.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.village.api.entity.Message;
import com.pig4cloud.pig.village.message.mapper.MessageMapper;
import com.pig4cloud.pig.village.message.service.IMessageService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author limbray.li
 * @date 2021/6/19
 */
@Service
@RequiredArgsConstructor
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements IMessageService {
	@Override
	public List<Message> getMessageAfter(LocalDateTime dateTime) {
		LambdaQueryWrapper<Message> query = Wrappers.lambdaQuery();
		query.ge(dateTime != null,Message::getDate,dateTime);
		return super.list(query);
	}
}
